/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.azservicos.entidade;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Geovane
 */
@Entity
@Table(name = "servico")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Servico.findAll", query = "SELECT s FROM Servico s"),
    @NamedQuery(name = "Servico.findByServico", query = "SELECT s FROM Servico s WHERE s.servico = :servico"),
    @NamedQuery(name = "Servico.findByAtividade", query = "SELECT s FROM Servico s WHERE s.atividade = :atividade"),
    @NamedQuery(name = "Servico.findByCategoria", query = "SELECT s FROM Servico s WHERE s.categoria = :categoria")})
public class Servico implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "servico")
    private Integer servico;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "atividade")
    private String atividade;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "categoria")
    private String categoria;
    @JoinColumn(name = "anuncio_anuncio", referencedColumnName = "anuncio")
    @ManyToOne(optional = false)
    private Anuncio anuncioAnuncio;

    public Servico() {
    }

    public Servico(Integer servico) {
        this.servico = servico;
    }

    public Servico(Integer servico, String atividade, String categoria) {
        this.servico = servico;
        this.atividade = atividade;
        this.categoria = categoria;
    }

    public Integer getServico() {
        return servico;
    }

    public void setServico(Integer servico) {
        this.servico = servico;
    }

    public String getAtividade() {
        return atividade;
    }

    public void setAtividade(String atividade) {
        this.atividade = atividade;
    }

    public String getCategoria() {
        return categoria;
    }

    public void setCategoria(String categoria) {
        this.categoria = categoria;
    }

    public Anuncio getAnuncioAnuncio() {
        return anuncioAnuncio;
    }

    public void setAnuncioAnuncio(Anuncio anuncioAnuncio) {
        this.anuncioAnuncio = anuncioAnuncio;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (servico != null ? servico.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Servico)) {
            return false;
        }
        Servico other = (Servico) object;
        if ((this.servico == null && other.servico != null) || (this.servico != null && !this.servico.equals(other.servico))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.azservicos.entidade.Servico[ servico=" + servico + " ]";
    }
    
}
